package com.huizhan.web.view;

import com.huizhan.web.model.*;

import java.util.*;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.*;

@ApiModel(value =  "权限树形结构")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
public class AuthorizeTree extends Authorize implements Serializable {
	private static final long serialVersionUID =  271036682679543683L;
 
    public void addChildren(List<Authorize> list){
        for (Authorize authorize : list) {
            if  (authorize.getParentId()==this.getAuthorizeId()){
                AuthorizeTree tree1 = new AuthorizeTree(authorize);
                children.add(tree1);
                tree1.addChildren(list);
            }
        }
    }

    public AuthorizeTree(Authorize model){
        this.setAuthorizeId(model.getAuthorizeId());
        this.setCreateDate(model.getCreateDate());
        this.setIcon(model.getIcon());
        this.setIndexNo(model.getIndexNo());
        this.setLevel(model.getLevel());
        this.setName(model.getName());
        this.setNameEn(model.getNameEn());
        this.setParentId(model.getParentId());
        this.setUrl(model.getUrl());
        this.children=new ArrayList<AuthorizeTree>();
    }

    public AuthorizeTree(){
        this.children=new ArrayList<AuthorizeTree>();
    }

    /**
     * 子级
     */
	@ApiModelProperty(value = "子级")
    private List<AuthorizeTree> children;


    /**
     * 获取
     * @return
     */
    public List<AuthorizeTree> getChildren()
    {
        return this.children;
    }

    
    /**
     * 设置
     * @return
     */
    public void setChildren(List<AuthorizeTree> model)
    {
         this.children=model;
    }

}